<template>
  <common-page
    ref="commonPage"
    :bg-path="bgPath"
    :web-path="webPath"
    :columns="columns"
    :search-items="searchItems"
    :form-items="formItems"
  />
</template>
<script>
export default {
  data() {
    return {
      // ===== ===== ===== ===== 全局属性 ===== ===== ===== =====
      // 后台接口路径
      bgPath: 'health/person/consultation/appointment',
      // Web路径
      webPath: 'health/person/consultation/Appointment',
      // ===== ===== ===== ===== 页面配置 ===== ===== ===== =====
      // 搜索内容
      searchItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "id",
              name: "ID",
              span: 6,
              type: "id",
              config: {
                edit: false
              }
            },
            {
              code: "code",
              name: "编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "name",
              name: "名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "userCode",
              name: "用户编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "userName",
              name: "用户名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "doctorCode",
              name: "医生编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "doctorName",
              name: "医生名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "storeCode",
              name: "门店编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "storeName",
              name: "门店名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "minAppointmentDate",
              name: "最早日期",
              span: 6,
              type: "date",
              config: {
                edit: false
              }
            },
            {
              code: "maxAppointmentDate",
              name: "最晚日期",
              span: 6,
              type: "date",
              config: {
                edit: false
              }
            },
            {
              code: "minStartTime",
              name: "最早开始时间",
              span: 6,
              type: "time",
              config: {
                edit: false
              }
            },
            {
              code: "maxStartTime",
              name: "最晚开始时间",
              span: 6,
              type: "time",
              config: {
                edit: false
              }
            },
            {
              code: "minEndTime",
              name: "最早结束时间",
              span: 6,
              type: "time",
              config: {
                edit: false
              }
            },
            {
              code: "maxEndTime",
              name: "最晚结束时间",
              span: 6,
              type: "time",
              config: {
                edit: false
              }
            },
            {
              code: "stateSign",
              name: "状态标识",
              type: "select",
              span: 6,
              config: {
                edit: false,
                keyField: "key",
                valueField: "value",
                options: [
                  { key: "1", value: "预约中" },
                  { key: "2", value: "预约成功" },
                  { key: "3", value: "预约失败" },
                  { key: "4", value: "预约结束" }
                ]
              }
            },
            {
              code: "content",
              name: "说明",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            }
          ]
        }
      ],
      // 列表内容
      columns: [
        {
          code: "id",
          name: "ID",
          span: 6,
          type: "id",
          config: {
            edit: false
          }
        },
        {
          code: "code",
          name: "编码",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "name",
          name: "名称",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "userCode",
          name: "用户编码",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "userName",
          name: "用户名称",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "doctorCode",
          name: "医生编码",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "doctorName",
          name: "医生名称",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "storeCode",
          name: "门店编码",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "storeName",
          name: "门店名称",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "appointmentDate",
          name: "日期",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "startTime",
          name: "开始时间",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "endTime",
          name: "结束时间",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "stateSign",
          name: "状态标识",
          type: "select",
          span: 6,
          config: {
            edit: false,
            keyField: "key",
            valueField: "value",
            options: [
              { key: "1", value: "预约中" },
              { key: "2", value: "预约成功" },
              { key: "3", value: "预约失败" },
              { key: "4", value: "预约结束" }
            ]
          }
        },
        {
          code: "content",
          name: "说明",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        }
      ],
      // 增加/修改/详情 表单
      formItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "id",
              name: "ID",
              span: 6,
              type: "id",
              config: {
                edit: false
              }
            },
            {
              code: "code",
              name: "编码",
              span: 6,
              type: "text",
              config: {
                edit: false,
                require: true
              }
            },
            {
              code: "name",
              name: "名称",
              span: 6,
              type: "text",
              config: {
                edit: false,
                require: true
              }
            },
            {
              code: "userCode",
              span: 6,
              name: "用户编码",
              type: "popup",
              config: {
                url: "base/user/user/user",
                filedList: [
                  { code: 'id', name: 'ID' },
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    userName: row.name,
                    userCode: row.code,
                    userId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "userName",
              name: "用户名称",
              span: 6,
              type: "text",
              config: {
                edit: false,
                disabled: true
              }
            },
            {
              code: "doctorCode",
              name: "医生编码",
              type: "popup",
              span: 6,
              config: {
                url: "base/user/user/storeuser",
                filedList: [
                  { code: 'id', name: 'ID' },
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    doctorName: row.name,
                    doctorCode: row.code,
                    doctorId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "doctorName",
              name: "医生名称",
              span: 6,
              type: "text",
              config: {
                edit: false,
                disabled: true
              }
            },
            {
              code: "storeCode",
              name: "门店编码",
              span: 6,
              type: "popup",
              config: {
                url: "base/user/user/store",
                filedList: [
                  { code: 'id', name: 'ID' },
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    storeName: row.name,
                    storeCode: row.code,
                    storeId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "storeName",
              name: "门店名称",
              span: 6,
              type: "text",
              config: {
                edit: false,
                require: true,
                disabled: true
              }
            },
            {
              code: "appointmentDate",
              name: "日期",
              span: 6,
              type: "date",
              config: {
                edit: false
              }
            },
            {
              code: "startTime",
              name: "开始时间",
              span: 6,
              type: "time",
              config: {
                edit: false
              }
            },
            {
              code: "endTime",
              name: "结束时间",
              span: 6,
              type: "time",
              config: {
                edit: false
              }
            },
            {
              code: "stateSign",
              name: "状态标识",
              type: "select",
              span: 6,
              config: {
                edit: false,
                keyField: "key",
                valueField: "value",
                options: [
                  { key: "1", value: "预约中" },
                  { key: "2", value: "预约成功" },
                  { key: "3", value: "预约失败" },
                  { key: "4", value: "预约结束" }
                ]
              }
            },
            {
              code: "content",
              name: "说明",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            }
          ]
        }]
    }
  }
}
</script>
